<include file="public:header" />
<include file="public:left" />
<style>
    #select-area select{height:30px;}
</style>
<div class="page_title">
    <h2 class="fl">编辑微信</h2>
</div>
<form  method="post" enctype="multipart/form-data" id="brandForm" name="brandForm">
    <section>
        <ul class="ulColumn2">
            <li>
                <span class="item_name" style="width:120px;">appid：</span>
                <input type="text" class="textbox textbox_295" name="we_chat_appid" placeholder="appid" value="{$wechat.we_chat_appid}"/>
            </li>
            <li>
                <span class="item_name" style="width:120px;">secret：</span>
                <input type="text" class="textbox textbox_295" name="we_chat_appkey" placeholder="secret" value="{$wechat.we_chat_secret}"/>
            </li>
            <li>
                <span class="item_name" style="width:120px;">授权登录回调地址：</span>
                <input type="text" class="textbox textbox_295" name="we_chat_back_url" placeholder="secret" value="{$wechat.we_chat_back_url}"/>
            </li>
            <li style="width:100%;text-align: center">
                <input type="button" class="link_btn" value="提交"/>
            </li>
        </ul>
    </section>
</form>
<!--tabStyle-->
<style type="text/css" src="__STATIC__/admin/js/laydate/need/laydate.css" ></style>
<script src="__STATIC__/admin/js/laydate/laydate.js"></script>

<script type="text/javascript">
    $(document).ready(function(){
        $(".link_btn").click(function(){
            var formData = new FormData();
            var we_chat_appid = $('input[name="we_chat_appid"]').val();
            var we_chat_appkey = $('input[name="we_chat_appkey"]').val();
            var we_chat_back_url = $('input[name="we_chat_back_url"]').val();

            formData.append('we_chat_appid',we_chat_appid);
            formData.append('we_chat_appkey',we_chat_appkey);
            formData.append('we_chat_back_url',we_chat_back_url);
           
            $.ajax({
                url:"{:url('Wechat/set')}",
                type:'POST',
                data:formData,
				dataType: 'json',
                async:false,
                processData:false,
                contentType:false,
                success:function(result){
                    if(result.code == '0'){
                        layer.alert(result.msg);
                    }else{
                        layer.alert(result.msg, {
                            btn: ['确定']
                        },
                        function (index, item) {
                            location.href = result.url;
                        });
                    }
                }

            });
        });
    });
</script>
</div>
</section>
</body>
</html>
